<!DOCTYPE html>
<html >
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>继承</title>
    <script>
        class Human{
            constructor(sex,name){
                this.arms=2;
                this.legs=2;
                this.head=1;
                this.sex=sex;
                this.name=name;
            }
            breath(){
                console.log("呼吸")
            }
            walk(){
                console.log("行走")
            }
        }
        let someone=new Human("男","张三");
        class Student extends Human{
            constructor(sex,name,sid){
                super(sex,name);
                this.sid=sid;
            }
            learn(){
                console.log("学生会学习")
            }
        }
        let someStudent=new Student("男","小明","001");
        class Teacher extends Human{
            constructor(sex,name,tid){
                super(sex,name);
                this.tid=tid;
            }
            teach(){
                console.log("老师会讲课")
            }
        }
        let someTeacher=new Teacher("女","郭老师","007");
    </script>
</head>
<body>
    
</body>
</html>